package is.progetto2.activity;

import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;

public class ActivitySorted {

	private	TreeSet<Job> setJob;
	private int maxDuration=0;
	
	protected ActivitySorted(List<Job> listjobs){
		setJob=new TreeSet<>(listjobs);
	}
	
	public Job getFirstJob(){
		return setJob.first();
	}
	
	public Job getLastJob(){
		return setJob.last();
	}
	
	public Job getNextJob(Job j){
		return setJob.higher(j);
	}
	
	public Job getPreviusJob(Job j){
		return setJob.lower(j);
	}

	public int getAproximateDuration() {
		return this.maxDuration;
	}

	public List<Bind> getBind(Job p) {
		return p.ref;
	}
	
	public Iterator<Job> iterator(){
		return setJob.iterator();
	}

	@Override
	public String toString() {
		return "ActivitySorted [setJob=" + setJob +", maxDuration=" + maxDuration + "]";
	}
	
}
